import request from "@/utils/request";
import type { addClaResponseData, allClaResponseData, cla, deleteClaResponseData, pageClaResponseData, pageClass } from "./type";

//@ts-ignore
enum API{
    ADD_CLASS = "/manage/class/add",
    FIND_BY_ID = "/manage/class/find",
    UPDATE_CLASS = "/manage/class/update",
    ALL_CLASS = "/manage/class/all",
    PAGE_CLASS = "/manage/class/list",
    DELETE_CLASS = "/manage/class/delete"
}

//添加班级
export const reqAddClass = (data:cla)=>request.post<any,addClaResponseData>(API.ADD_CLASS,data);
//根据id查询班级
export const reqFindById = (_id:string)=>request.get<any,addClaResponseData>(API.FIND_BY_ID+`?_id=${_id}`);
//更新专业信息
export const reqUpdateClass = (data:cla)=>request.post<any,addClaResponseData>(API.UPDATE_CLASS,data);
//获取所有班级列表
export const reqAllClass = ()=>request.get<any,allClaResponseData>(API.ALL_CLASS);
//分页获取班级列表
export const reqPageClass = (data:pageClass)=>request.post<any,pageClaResponseData>(API.PAGE_CLASS,data);
//删除班级
export const reqDeleteClass = (classId:string)=>request.post<any,deleteClaResponseData>(API.DELETE_CLASS,{classId})